cmake_minimum_required(VERSION 3.10)

project(mclisp)

option(CONFIG_DEBUG_LOG "enable debug level of logging" OFF)
option(CONFIG_TEST "build and test" OFF)
option(CONFIG_ASAN "use address sanitize" OFF)

add_compile_options(-Wall -Wextra -Wpedantic -Werror)

if(CONFIG_ASAN)
  add_compile_options(-fsanitize=address)
endif()

configure_file(mcl/config.h.in mcl/config.h)

add_executable(
  main
  mcl/builtin.c
  mcl/da.c
  mcl/log.c
  mcl/parser.c
  mcl/rt.c
  mcl/sym.c
  mcl/val.c
  mcl/writer.c
  mcl/main.c)

target_include_directories(main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
                                        ${CMAKE_CURRENT_BINARY_DIR})

add_executable(makesym mcl/makesym.c)

if(CONFIG_ASAN)
  target_link_libraries(main PRIVATE asan)
endif()
